/**
 * doc: install and use
 * https://fontawesome.com/v6.0/docs/web/use-with/vue/
 * https://www.npmjs.com/package/@fortawesome/vue-fontawesome
 * https://fontawesome.com/v5.15/icons
 * https://www.naiveui.com/zh-CN/os-theme/components/button
 * 
 **/
import { CONF } from './config'
//load urls
var config_urls = {};
config_urls.testdbs = "/t/testdbs"
if (CONF.BSType == 'webserver') {
    config_urls.getBinssUser = "/b/getBinssUser"
    config_urls.addBinssUser = "/b/addBinssUser"
    config_urls.updateComName = "/u/updateComName"
    config_urls.updateKeyDays = "/u/updateKeyDays"
    config_urls.getAlllogger = "/l/getAlllogger"
    config_urls.setConfigNet = "/u/setConfigNet"
    config_urls.loggin = "/u/loggin"
    config_urls.updatePwd = "/u/updatePwd"
    config_urls.updateWorkMode = "/u/updateWorkMode"
    config_urls.updatePwd = "/u/updatePwd"
} else if (CONF.BSType == 'client') { 
    //client
    config_urls.getStatus = "/getStatus"
    config_urls.loggin = "/loggin"
    config_urls.setUinfo = "/setUinfo"
    config_urls.setConfigNet = "/setConfigNet"
    config_urls.updateComName = "/updateComName"
    config_urls.updatePwd = "/updatePwd"
    config_urls.updateUinfo = "/updateUinfo"
}
let DEFAULTPAGE, DEFAULTPAGEINDEX
if (CONF.BSType == "webserver") {
    DEFAULTPAGE = "device-type1"
    DEFAULTPAGEINDEX = "1-1"
} else {
    // DEFAULTPAGE = "test-client"
    DEFAULTPAGE = "test-client"
    DEFAULTPAGEINDEX = "1"
}
const userInfo = {
    /** 存储用户配置信息 */
    UHID: '1234567',
    SISSIONKEY: "x451as1da21d2d21121a",
    COMPANYNAME: "南京十方网络科技有限公司",
    SORFTVSERION: 'v1.0.0',
    KEYTACTICS: 3,  //密钥更新天数
    NETCONFIG: null,
    NETWORKMODE: null, //工作模式

    BSTYPE: CONF.BSType,
    STATUS: 0, //状态
    ENV: CONF.BSType, //类型
    DEFAULTPAGE: DEFAULTPAGE,    //默认显示页面
    DEFAULTPAGEINDEX: DEFAULTPAGEINDEX, //默认下标
    KEYSTATUS: 0 //口令输入状态 0 success,  1 error
}

//load mneu
let menu;
if (CONF.BSType == 'webserver') {
    menu = [
        {
            title: '节点网关', index: '1', icon: 'sitemap', child: [
                { title: '服务器', index: '1-1', icon: null, child: null, route: 'device-type-1' },
                { title: '便携式小盒子', index: '1-2', icon: null, child:null, route: 'device-type-2' },
            ]
        },
        {
            title: '系统配置', index: '2', icon: 'tools', child: [
                { title: '网络配置', index: '2-1', icon: null, child: null, route:'net-config' },
                { title: '密钥更新策略', index: '2-2', icon: null, child: null, route:'session-key' },
                { title: '系统名称变更', index: '2-3', icon: null, child:null, route:'cpy-name' },
            ]
        },
        {
            title: '操作日志', index: '3', icon: 'file-alt', child: null, route:'logger'
        }
    ]
} else if (CONF.BSType == 'client') {
    menu = [
        { title: '首页', index: '1', icon: 'home', child: null, route:'test-client' },
        { title: '入网配置', index: '2', icon: 'globe', child: null, route:'net-configuration' },
        {
            title: '系统配置', index: '3', icon: 'cogs', child: [
                { title: '恢复出厂设置', index: '3-1', icon: '', child: null, route:'activate' },
                // { title: '设备管理', index: '3-2', icon: '', child: null ,route:'act-step'},
                { title: '系统名称', index: '3-2', icon: '', child: null, route:'cpy-name' },
            ]
        }
    ]
}

//load naive-ui
import {
    // create naive ui
    create,
    // component
    NButton,
    NDataTable,
    NPagination,
    NInput,
    NFormItem,
    NDatePicker,
    NConfigProvider,
    NInputNumber,
    NModal,
    NForm,
    NInputGroup,
    NPopselect,
} from 'naive-ui'

const naive = create({
    components: [NPopselect,NInputGroup,NForm,NModal,NInputNumber,NConfigProvider,NButton, NDataTable, NPagination,NInput,NFormItem, NDatePicker]
})
//load icon
import { library } from "@fortawesome/fontawesome-svg-core"
import { far, faAngry } from '@fortawesome/free-regular-svg-icons'
import { fab, faAirbnb } from '@fortawesome/free-brands-svg-icons'
import { fal, faSearch, faPlus } from "@fortawesome/pro-light-svg-icons"
import { fas, faHome, faRoute, faCogs, faUserTag, faGlobe, faNetworkWired} from "@fortawesome/free-solid-svg-icons"

library.add(fas, far, fab, fal, faAngry, faUserTag, faAirbnb)
if (CONF.BSType == 'webserver') {
    library.add(faSearch, faPlus);
} else if (CONF.BSType == 'client') {
    library.add(faHome, faRoute, faCogs, faGlobe, faNetworkWired);
}


import { FontAwesomeIcon, FontAwesomeLayers, FontAwesomeLayersText } from "@fortawesome/vue-fontawesome"
export {
    FontAwesomeIcon as icon,
    FontAwesomeLayers as iconLayer,
    FontAwesomeLayersText as iconText,
    menu as main_menu,
    naive,
    config_urls as urls,
    userInfo
}